home *** CD-ROM | disk | FTP | other *** search
/ Inter.Net 55-1 / Inter.Net 55-1.iso / CBuilder / Setup / BCB / data.z / mapiutil.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-02-09  |  30.0 KB  |  898 lines

  1. /*
  2.  *  M A P I U T I L . H
  3.  *
  4.  *  Definitions and prototypes for utility functions provided by MAPI
  5.  *  in MAPI[xx].DLL.
  6.  *
  7.  *  Copyright 1986-1996 Microsoft Corporation. All Rights Reserved.
  8.  */
  9.  
  10. #ifndef _MAPIUTIL_H_
  11. #define _MAPIUTIL_H_
  12. #pragma option push -b
  13.  
  14.  
  15. #ifdef __BORLANDC__
  16. #  include <pshpack8.h>
  17. #endif
  18.  
  19. #if defined (WIN32) && !defined (_WIN32)
  20. #define _WIN32
  21. #endif
  22.  
  23. #ifdef __cplusplus
  24. extern "C" {
  25. #endif
  26.  
  27. #ifndef MAPIX_H
  28.  
  29. #include <mapix.h>
  30.  
  31. #endif
  32.  
  33. #ifdef WIN16
  34.  
  35. #include <storage.h>
  36.  
  37. #endif
  38.  
  39. #ifndef BEGIN_INTERFACE
  40. #define BEGIN_INTERFACE
  41. #endif
  42.  
  43.  
  44. /* IMAPITable in memory */
  45.  
  46. /* ITableData Interface ---------------------------------------------------- */
  47.  
  48. DECLARE_MAPI_INTERFACE_PTR(ITableData, LPTABLEDATA);
  49.  
  50. typedef void (STDAPICALLTYPE CALLERRELEASE)(
  51.     ULONG       ulCallerData,
  52.     LPTABLEDATA lpTblData,
  53.     LPMAPITABLE lpVue
  54. );
  55.  
  56. #define MAPI_ITABLEDATA_METHODS(IPURE)                                  \
  57.     MAPIMETHOD(HrGetView)                                               \
  58.         (THIS_  LPSSortOrderSet             lpSSortOrderSet,            \
  59.                 CALLERRELEASE FAR *         lpfCallerRelease,           \
  60.                 ULONG                       ulCallerData,               \
  61.                 LPMAPITABLE FAR *           lppMAPITable) IPURE;        \
  62.     MAPIMETHOD(HrModifyRow)                                             \
  63.         (THIS_  LPSRow) IPURE;                                          \
  64.     MAPIMETHOD(HrDeleteRow)                                             \
  65.         (THIS_  LPSPropValue                lpSPropValue) IPURE;        \
  66.     MAPIMETHOD(HrQueryRow)                                              \
  67.         (THIS_  LPSPropValue                lpsPropValue,               \
  68.                 LPSRow FAR *                lppSRow,                    \
  69.                 ULONG FAR *                 lpuliRow) IPURE;            \
  70.     MAPIMETHOD(HrEnumRow)                                               \
  71.         (THIS_  ULONG                       ulRowNumber,                \
  72.                 LPSRow FAR *                lppSRow) IPURE;             \
  73.     MAPIMETHOD(HrNotify)                                                \
  74.         (THIS_  ULONG                       ulFlags,                    \
  75.                 ULONG                       cValues,                    \
  76.                 LPSPropValue                lpSPropValue) IPURE;        \
  77.     MAPIMETHOD(HrInsertRow)                                             \
  78.         (THIS_  ULONG                       uliRow,                     \
  79.                 LPSRow                      lpSRow) IPURE;              \
  80.     MAPIMETHOD(HrModifyRows)                                            \
  81.         (THIS_  ULONG                       ulFlags,                    \
  82.                 LPSRowSet                   lpSRowSet) IPURE;           \
  83.     MAPIMETHOD(HrDeleteRows)                                            \
  84.         (THIS_  ULONG                       ulFlags,                    \
  85.                 LPSRowSet                   lprowsetToDelete,           \
  86.                 ULONG FAR *                 cRowsDeleted) IPURE;        \
  87.  
  88. #undef       INTERFACE
  89. #define      INTERFACE  ITableData
  90. DECLARE_MAPI_INTERFACE_(ITableData, IUnknown)
  91. {
  92.     BEGIN_INTERFACE
  93.     MAPI_IUNKNOWN_METHODS(PURE)
  94.     MAPI_ITABLEDATA_METHODS(PURE)
  95. };
  96.  
  97.  
  98. /* Entry Point for in memory ITable */
  99.  
  100.  
  101. /*  CreateTable()
  102.  *      Creates the internal memory structures and object handle
  103.  *      to bring a new table into existence.
  104.  *
  105.  *  lpInterface
  106.  *      Interface ID of the TableData object (IID_IMAPITableData)
  107.  *
  108.  *  lpAllocateBuffer, lpAllocateMore, and lpFreeBuffer
  109.  *      Function addresses are provided by the caller so that
  110.  *      this DLL allocates/frees memory appropriately.
  111.  *  lpvReserved
  112.  *      Reserved.  Should be NULL.
  113.  *  ulTableType
  114.  *      TBLTYPE_DYNAMIC, etc.  Visible to the calling application
  115.  *      as part of the GetStatus return data on its views
  116.  *  ulPropTagIndexColumn
  117.  *      Index column for use when changing the data
  118.  *  lpSPropTagArrayColumns
  119.  *      Column proptags for the minimum set of columns in the table
  120.  *  lppTableData
  121.  *      Address of the pointer which will receive the TableData object
  122.  */
  123.  
  124. STDAPI_(SCODE)
  125. CreateTable( LPCIID                 lpInterface,
  126.              ALLOCATEBUFFER FAR *   lpAllocateBuffer,
  127.              ALLOCATEMORE FAR *     lpAllocateMore,
  128.              FREEBUFFER FAR *       lpFreeBuffer,
  129.              LPVOID                 lpvReserved,
  130.              ULONG                  ulTableType,
  131.              ULONG                  ulPropTagIndexColumn,
  132.              LPSPropTagArray        lpSPropTagArrayColumns,
  133.              LPTABLEDATA FAR *      lppTableData );
  134.  
  135. /*  HrGetView()
  136.  *      This function obtains a new view on the underlying data
  137.  *      which supports the IMAPITable interface.  All rows and columns
  138.  *      of the underlying table data are initially visible
  139.  *  lpSSortOrderSet
  140.  *      if specified, results in the view being sorted
  141.  *  lpfCallerRelease
  142.  *      pointer to a routine to be called when the view is released, or
  143.  *      NULL.
  144.  *  ulCallerData
  145.  *      arbitrary data the caller wants saved with this view and returned in
  146.  *      the Release callback.
  147.  */
  148.  
  149. /*  HrModifyRows()
  150.  *      Add or modify a set of rows in the table data
  151.  *  ulFlags
  152.  *      Must be zero
  153.  *  lpSRowSet
  154.  *      Each row in the row set contains all the properties for one row
  155.  *      in the table.  One of the properties must be the index column.  Any
  156.  *      row in the table with the same value for its index column is
  157.  *      replaced, or if there is no current row with that value the
  158.  *      row is added.
  159.  *      Each row in LPSRowSet MUST have a unique Index column!
  160.  *      If any views are open, the view is updated as well.
  161.  *      The properties do not have to be in the same order as the
  162.  *      columns in the current table
  163.  */
  164.  
  165. /*  HrModifyRow()
  166.  *      Add or modify one row in the table
  167.  *  lpSRow
  168.  *      This row contains all the properties for one row in the table.
  169.  *      One of the properties must be the index column.  Any row in
  170.  *      the table with the same value for its index column is
  171.  *      replaced, or if there is no current row with that value the
  172.  *      row is added
  173.  *      If any views are open, the view is updated as well.
  174.  *      The properties do not have to be in the same order as the
  175.  *      columns in the current table
  176.  */
  177.  
  178. /*  HrDeleteRows()
  179.  *      Delete a row in the table.
  180.  *  ulFlags
  181.  *      TAD_ALL_ROWS - Causes all rows in the table to be deleted
  182.  *                     lpSRowSet is ignored in this case.
  183.  *  lpSRowSet
  184.  *      Each row in the row set contains all the properties for one row
  185.  *      in the table.  One of the properties must be the index column.  Any
  186.  *      row in the table with the same value for its index column is
  187.  *      deleted.
  188.  *      Each row in LPSRowSet MUST have a unique Index column!
  189.  *      If any views are open, the view is updated as well.
  190.  *      The properties do not have to be in the same order as the
  191.  *      columns in the current table
  192.  */
  193. #define TAD_ALL_ROWS    1
  194.  
  195. /*  HrDeleteRow()
  196.  *      Delete a row in the table.
  197.  *  lpSPropValue
  198.  *      This property value specifies the row which has this value
  199.  *      for its index column
  200.  */
  201.  
  202. /*  HrQueryRow()
  203.  *      Returns the values of a specified row in the table
  204.  *  lpSPropValue
  205.  *      This property value specifies the row which has this value
  206.  *      for its index column
  207.  *  lppSRow
  208.  *      Address of where to return a pointer to an SRow
  209.  *  lpuliRow
  210.  *    Address of where to return the row number. This can be NULL
  211.  *    if the row number is not required.
  212.  *
  213.  */
  214.  
  215. /*  HrEnumRow()
  216.  *      Returns the values of a specific (numbered) row in the table
  217.  *  ulRowNumber
  218.  *      Indicates row number 0 to n-1
  219.  *  lppSRow
  220.  *      Address of where to return a pointer to a SRow
  221.  */
  222.  
  223. /*  HrInsertRow()
  224.  *      Inserts a row into the table.
  225.  *  uliRow
  226.  *      The row number before which this row will be inserted into the table.
  227.  *      Row numbers can be from 0 to n where o to n-1 result in row insertion
  228.  *    a row number of n results in the row being appended to the table.
  229.  *  lpSRow
  230.  *      This row contains all the properties for one row in the table.
  231.  *      One of the properties must be the index column.  Any row in
  232.  *      the table with the same value for its index column is
  233.  *      replaced, or if there is no current row with that value the
  234.  *      row is added
  235.  *      If any views are open, the view is updated as well.
  236.  *      The properties do not have to be in the same order as the
  237.  *      columns in the current table
  238.  */
  239.  
  240.  
  241. /* IMAPIProp in memory */
  242.  
  243. /* IPropData Interface ---------------------------------------------------- */
  244.  
  245.  
  246. #define MAPI_IPROPDATA_METHODS(IPURE)                                   \
  247.     MAPIMETHOD(HrSetObjAccess)                                          \
  248.         (THIS_  ULONG                       ulAccess) IPURE;            \
  249.     MAPIMETHOD(HrSetPropAccess)                                         \
  250.         (THIS_  LPSPropTagArray             lpPropTagArray,             \
  251.                 ULONG FAR *                 rgulAccess) IPURE;          \
  252.     MAPIMETHOD(HrGetPropAccess)                                         \
  253.         (THIS_  LPSPropTagArray FAR *       lppPropTagArray,            \
  254.                 ULONG FAR * FAR *           lprgulAccess) IPURE;        \
  255.     MAPIMETHOD(HrAddObjProps)                                           \
  256.         (THIS_  LPSPropTagArray             lppPropTagArray,            \
  257.                 LPSPropProblemArray FAR *   lprgulAccess) IPURE;
  258.  
  259.  
  260. #undef       INTERFACE
  261. #define      INTERFACE  IPropData
  262. DECLARE_MAPI_INTERFACE_(IPropData, IMAPIProp)
  263. {
  264.     BEGIN_INTERFACE
  265.     MAPI_IUNKNOWN_METHODS(PURE)
  266.     MAPI_IMAPIPROP_METHODS(PURE)
  267.     MAPI_IPROPDATA_METHODS(PURE)
  268. };
  269.  
  270. DECLARE_MAPI_INTERFACE_PTR(IPropData, LPPROPDATA);
  271.  
  272.  
  273. /* Entry Point for in memory IMAPIProp */
  274.  
  275.  
  276. /*  CreateIProp()
  277.  *      Creates the internal memory structures and object handle
  278.  *      to bring a new property interface into existance.
  279.  *
  280.  *  lpInterface
  281.  *      Interface ID of the TableData object (IID_IMAPIPropData)
  282.  *
  283.  *  lpAllocateBuffer, lpAllocateMore, and lpFreeBuffer
  284.  *      Function addresses are provided by the caller so that
  285.  *      this DLL allocates/frees memory appropriately.
  286.  *  lppPropData
  287.  *      Address of the pointer which will receive the IPropData object
  288.  *  lpvReserved
  289.  *      Reserved.  Should be NULL.
  290.  */
  291.  
  292. STDAPI_(SCODE)
  293. CreateIProp( LPCIID                 lpInterface,
  294.              ALLOCATEBUFFER FAR *   lpAllocateBuffer,
  295.              ALLOCATEMORE FAR *     lpAllocateMore,
  296.              FREEBUFFER FAR *       lpFreeBuffer,
  297.              LPVOID                 lpvReserved,
  298.              LPPROPDATA FAR *       lppPropData );
  299.  
  300. /*
  301.  *  Defines for prop/obj access
  302.  */
  303. #define IPROP_READONLY      ((ULONG) 0x00000001)
  304. #define IPROP_READWRITE     ((ULONG) 0x00000002)
  305. #define IPROP_CLEAN         ((ULONG) 0x00010000)
  306. #define IPROP_DIRTY         ((ULONG) 0x00020000)
  307.  
  308. /*
  309.  -  HrSetPropAccess
  310.  -
  311.  *  Sets access right attributes on a per-property basis.  By default,
  312.  *  all properties are read/write.
  313.  *
  314.  */
  315.  
  316. /*
  317.  -  HrSetObjAccess
  318.  -
  319.  *  Sets access rights for the object itself.  By default, the object has
  320.  *  read/write access.
  321.  *
  322.  */
  323.  
  324. #ifndef NOIDLEENGINE
  325.  
  326. /* Idle time scheduler */
  327.  
  328. /*
  329.  *  PRI
  330.  *
  331.  *  Priority of an idle task.
  332.  *  The idle engine sorts tasks by priority, and the one with the higher
  333.  *  value runs first. Within a priority level, the functions are called
  334.  *  round-robin.
  335.  */
  336.  
  337. #define PRILOWEST   -32768
  338. #define PRIHIGHEST  32767
  339. #define PRIUSER     0
  340.  
  341. /*
  342.  *  IRO
  343.  *
  344.  *  Idle routine options.  This is a combined bit mask consisting of
  345.  *  individual firo's.  Listed below are the possible bit flags.
  346.  *
  347.  *      FIROWAIT and FIROINTERVAL are mutually exclusive.
  348.  *      If neither of the flags are specified, the default action
  349.  *      is to ignore the time parameter of the idle function and
  350.  *      call it as often as possible if firoPerBlock is not set;
  351.  *      otherwise call it one time only during the idle block
  352.  *      once the time constraint has been set. FIROINTERVAL
  353.  *      is also incompatible with FIROPERBLOCK.
  354.  *
  355.  *      FIROWAIT        - time given is minimum idle time before calling
  356.  *                        for the first time in the block of idle time,
  357.  *                        afterwhich call as often as possible.
  358.  *      FIROINTERVAL    - time given is minimum interval between each
  359.  *                        successive call
  360.  *      FIROPERBLOCK    - called only once per contiguous block of idle
  361.  *                        time
  362.  *      FIRODISABLED    - initially disabled when registered, the
  363.  *                        default is to enable the function when registered.
  364.  *      FIROONCEONLY    - called only one time by the scheduler and then
  365.  *                        deregistered automatically.
  366.  */
  367.  
  368. #define IRONULL         ((USHORT) 0x0000)
  369. #define FIROWAIT        ((USHORT) 0x0001)
  370. #define FIROINTERVAL    ((USHORT) 0x0002)
  371. #define FIROPERBLOCK    ((USHORT) 0x0004)
  372. #define FIRODISABLED    ((USHORT) 0x0020)
  373. #define FIROONCEONLY    ((USHORT) 0x0040)
  374.  
  375. /*
  376.  *  IRC
  377.  *
  378.  *  Idle routine change options. This is a combined bit mask consisting
  379.  *  of individual firc's; each one identifies an aspect of the idle task
  380.  *  that can be changed.
  381.  *
  382.  */
  383.  
  384. #define IRCNULL         ((USHORT) 0x0000)
  385. #define FIRCPFN         ((USHORT) 0x0001)   /* change function pointer */
  386. #define FIRCPV          ((USHORT) 0x0002)   /* change parameter block  */
  387. #define FIRCPRI         ((USHORT) 0x0004)   /* change priority         */
  388. #define FIRCCSEC        ((USHORT) 0x0008)   /* change time             */
  389. #define FIRCIRO         ((USHORT) 0x0010)   /* change routine options  */
  390.  
  391. /*
  392.  *  Type definition for idle functions.  An idle function takes one
  393.  *  parameter, an PV, and returns a BOOL value.
  394.  */
  395.  
  396. typedef BOOL (STDAPICALLTYPE FNIDLE) (LPVOID);
  397. typedef FNIDLE FAR *PFNIDLE;
  398.  
  399. /*
  400.  *  FTG
  401.  *
  402.  *  Function Tag.  Used to identify a registered idle function.
  403.  *
  404.  */
  405.  
  406. typedef void FAR *FTG;
  407. typedef FTG  FAR *PFTG;
  408. #define FTGNULL         ((FTG) NULL)
  409.  
  410. /*
  411.  -  MAPIInitIdle/MAPIDeinitIdle
  412.  -
  413.  *  Purpose:
  414.  *      Initialises the idle engine
  415.  *      If the initialisation succeded, returns 0, else returns -1
  416.  *
  417.  *  Arguments:
  418.  *      lpvReserved     Reserved, must be NULL.
  419.  */
  420.  
  421. STDAPI_(LONG)
  422. MAPIInitIdle (LPVOID lpvReserved);
  423.  
  424. STDAPI_(VOID)
  425. MAPIDeinitIdle (VOID);
  426.  
  427.  
  428. /*
  429.  *  FtgRegisterIdleRoutine
  430.  *
  431.  *      Registers the function pfn of type PFNIDLE, i.e., (BOOL (*)(LPVOID))
  432.  *      as an idle function.
  433.  *
  434.  *      The idle function will be called with the parameter pv by the
  435.  *      idle engine. The function has initial priority priIdle,
  436.  *      associated time csecIdle, and options iroIdle.
  437.  */
  438.  
  439. STDAPI_(FTG)
  440. FtgRegisterIdleRoutine (PFNIDLE lpfnIdle, LPVOID lpvIdleParam,
  441.     short priIdle, ULONG csecIdle, USHORT iroIdle);
  442.  
  443. /*
  444.  *  DeregisterIdleRoutine
  445.  *
  446.  *      Removes the given routine from the list of idle routines.
  447.  *      The routine will not be called again.  It is the responsibility
  448.  *      of the caller to clean up any data structures pointed to by the
  449.  *      pvIdleParam parameter; this routine does not free the block.
  450.  */
  451.  
  452. STDAPI_(void)
  453. DeregisterIdleRoutine (FTG ftg);
  454.  
  455. /*
  456.  *  EnableIdleRoutine
  457.  *
  458.  *      Enables or disables an idle routine.
  459.  */
  460.  
  461. STDAPI_(void)
  462. EnableIdleRoutine (FTG ftg, BOOL fEnable);
  463.  
  464. /*
  465.  *  ChangeIdleRoutine
  466.  *
  467.  *      Changes some or all of the characteristics of the given idle
  468.  *      function. The changes to make are indicated with flags in the
  469.  *      ircIdle parameter.
  470.  */
  471.  
  472. STDAPI_(void)
  473. ChangeIdleRoutine (FTG ftg, PFNIDLE lpfnIdle, LPVOID lpvIdleParam,
  474.     short priIdle, ULONG csecIdle, USHORT iroIdle, USHORT ircIdle);
  475.  
  476.  
  477. #endif  /* ! NOIDLEENGINE */
  478.  
  479.  
  480. /* IMalloc Utilities */
  481.  
  482. STDAPI_(LPMALLOC) MAPIGetDefaultMalloc(VOID);
  483.  
  484.  
  485. /* StreamOnFile (SOF) */
  486.  
  487. /*
  488.  *  Methods and #define's for implementing an OLE 2.0 storage stream
  489.  *  (as defined in the OLE 2.0 specs) on top of a system file.
  490.  */
  491.  
  492. #define SOF_UNIQUEFILENAME  ((ULONG) 0x80000000)
  493.  
  494. STDMETHODIMP OpenStreamOnFile(
  495.     LPALLOCATEBUFFER    lpAllocateBuffer,
  496.     LPFREEBUFFER        lpFreeBuffer,
  497.     ULONG               ulFlags,
  498.     LPTSTR              lpszFileName,
  499.     LPTSTR              lpszPrefix,
  500.     LPSTREAM FAR *      lppStream);
  501.  
  502. typedef HRESULT (STDMETHODCALLTYPE FAR * LPOPENSTREAMONFILE) (
  503.     LPALLOCATEBUFFER    lpAllocateBuffer,
  504.     LPFREEBUFFER        lpFreeBuffer,
  505.     ULONG               ulFlags,
  506.     LPTSTR              lpszFileName,
  507.     LPTSTR              lpszPrefix,
  508.     LPSTREAM FAR *      lppStream);
  509.  
  510. #ifdef  _WIN32
  511. #define OPENSTREAMONFILE "OpenStreamOnFile"
  512. #endif
  513. #ifdef  WIN16
  514. #define OPENSTREAMONFILE "_OPENSTREAMONFILE"
  515. #endif
  516.  
  517.  
  518. /* Property interface utilities */
  519.  
  520. /*
  521.  *  Copies a single SPropValue from Src to Dest.  Handles all the various
  522.  *  types of properties and will link its allocations given the master
  523.  *  allocation object and an allocate more function.
  524.  */
  525. STDAPI_(SCODE)
  526. PropCopyMore( LPSPropValue      lpSPropValueDest,
  527.               LPSPropValue      lpSPropValueSrc,
  528.               ALLOCATEMORE *    lpfAllocMore,
  529.               LPVOID            lpvObject );
  530.  
  531. /*
  532.  *  Returns the size in bytes of structure at lpSPropValue, including the
  533.  *  Value.
  534.  */
  535. STDAPI_(ULONG)
  536. UlPropSize( LPSPropValue    lpSPropValue );
  537.  
  538.  
  539. STDAPI_(BOOL)
  540. FEqualNames( LPMAPINAMEID lpName1, LPMAPINAMEID lpName2 );
  541.  
  542. #if defined(_WIN32) && !defined(_WINNT) && !defined(_WIN95) && !defined(_MAC)
  543. #define _WINNT
  544. #endif
  545.  
  546. STDAPI_(void)
  547. GetInstance(LPSPropValue lpPropMv, LPSPropValue lpPropSv, ULONG uliInst);
  548.  
  549. extern char rgchCsds[];
  550. extern char rgchCids[];
  551. extern char rgchCsdi[];
  552. extern char rgchCidi[];
  553.  
  554. STDAPI_(BOOL)
  555. FPropContainsProp( LPSPropValue lpSPropValueDst,
  556.                    LPSPropValue lpSPropValueSrc,
  557.                    ULONG        ulFuzzyLevel );
  558.  
  559. STDAPI_(BOOL)
  560. FPropCompareProp( LPSPropValue  lpSPropValue1,
  561.                   ULONG         ulRelOp,
  562.                   LPSPropValue  lpSPropValue2 );
  563.  
  564. STDAPI_(LONG)
  565. LPropCompareProp( LPSPropValue  lpSPropValueA,
  566.                   LPSPropValue  lpSPropValueB );
  567.  
  568. STDAPI_(HRESULT)
  569. HrAddColumns(   LPMAPITABLE         lptbl,
  570.                 LPSPropTagArray     lpproptagColumnsNew,
  571.                 LPALLOCATEBUFFER    lpAllocateBuffer,
  572.                 LPFREEBUFFER        lpFreeBuffer);
  573.  
  574. STDAPI_(HRESULT)
  575. HrAddColumnsEx( LPMAPITABLE         lptbl,
  576.                 LPSPropTagArray     lpproptagColumnsNew,
  577.                 LPALLOCATEBUFFER    lpAllocateBuffer,
  578.                 LPFREEBUFFER        lpFreeBuffer,
  579.                 void                (FAR *lpfnFilterColumns)(LPSPropTagArray ptaga));
  580.  
  581.  
  582. /* Notification utilities */
  583.  
  584. /*
  585.  *  Function that creates an advise sink object given a notification
  586.  *  callback function and context.
  587.  */
  588.  
  589. STDAPI
  590. HrAllocAdviseSink( LPNOTIFCALLBACK lpfnCallback,
  591.                    LPVOID lpvContext,
  592.                    LPMAPIADVISESINK FAR *lppAdviseSink );
  593.  
  594.  
  595. /*
  596.  *  Wraps an existing advise sink with another one which guarantees
  597.  *  that the original advise sink will be called in the thread on
  598.  *  which it was created.
  599.  */
  600.  
  601. STDAPI
  602. HrThisThreadAdviseSink( LPMAPIADVISESINK lpAdviseSink,
  603.                         LPMAPIADVISESINK FAR *lppAdviseSink);
  604.  
  605.  
  606.  
  607. /*
  608.  *  Allows a client and/or provider to force notifications
  609.  *  which are currently queued in the MAPI notification engine
  610.  *  to be dispatched without doing a message dispatch.
  611.  */
  612.  
  613. STDAPI HrDispatchNotifications (ULONG ulFlags);
  614.  
  615.  
  616. /* Service Provider Utilities */
  617.  
  618. /*
  619.  *  Structures and utility function for building a display table
  620.  *  from resources.
  621.  */
  622.  
  623. typedef struct {
  624.     ULONG           ulCtlType;          /* DTCT_LABEL, etc. */
  625.     ULONG           ulCtlFlags;         /* DT_REQUIRED, etc. */
  626.     LPBYTE          lpbNotif;           /*  pointer to notification data */
  627.     ULONG           cbNotif;            /* count of bytes of notification data */
  628.     LPTSTR          lpszFilter;         /* character filter for edit/combobox */
  629.     ULONG           ulItemID;           /* to validate parallel dlg template entry */
  630.     union {                             /* ulCtlType discriminates */
  631.         LPVOID          lpv;            /* Initialize this to avoid warnings */
  632.         LPDTBLLABEL     lplabel;
  633.         LPDTBLEDIT      lpedit;
  634.         LPDTBLLBX       lplbx;
  635.         LPDTBLCOMBOBOX  lpcombobox;
  636.         LPDTBLDDLBX     lpddlbx;
  637.         LPDTBLCHECKBOX  lpcheckbox;
  638.         LPDTBLGROUPBOX  lpgroupbox;
  639.         LPDTBLBUTTON    lpbutton;
  640.         LPDTBLRADIOBUTTON lpradiobutton;
  641.         LPDTBLMVLISTBOX lpmvlbx;
  642.         LPDTBLMVDDLBX   lpmvddlbx;
  643.         LPDTBLPAGE      lppage;
  644.     } ctl;
  645. } DTCTL, FAR *LPDTCTL;
  646.  
  647. typedef struct {
  648.     ULONG           cctl;
  649.     LPTSTR          lpszResourceName;   /* as usual, may be an integer ID */
  650.     union {                             /* as usual, may be an integer ID */
  651.         LPTSTR          lpszComponent;
  652.         ULONG           ulItemID;
  653.     };
  654.     LPDTCTL         lpctl;
  655. } DTPAGE, FAR *LPDTPAGE;
  656.  
  657.  
  658.  
  659. STDAPI
  660. BuildDisplayTable(  LPALLOCATEBUFFER    lpAllocateBuffer,
  661.                     LPALLOCATEMORE      lpAllocateMore,
  662.                     LPFREEBUFFER        lpFreeBuffer,
  663.                     LPMALLOC            lpMalloc,
  664.                     HINSTANCE           hInstance,
  665.                     UINT                cPages,
  666.                     LPDTPAGE            lpPage,
  667.                     ULONG               ulFlags,
  668.                     LPMAPITABLE *       lppTable,
  669.                     LPTABLEDATA *       lppTblData );
  670.  
  671.  
  672. /* MAPI structure validation/copy utilities */
  673.  
  674. /*
  675.  *  Validate, copy, and adjust pointers in MAPI structures:
  676.  *      notification
  677.  *      property value array
  678.  *      option data
  679.  */
  680.  
  681. STDAPI_(SCODE)
  682. ScCountNotifications(int cNotifications, LPNOTIFICATION lpNotifications,
  683.         ULONG FAR *lpcb);
  684.  
  685. STDAPI_(SCODE)
  686. ScCopyNotifications(int cNotification, LPNOTIFICATION lpNotifications,
  687.         LPVOID lpvDst, ULONG FAR *lpcb);
  688.  
  689. STDAPI_(SCODE)
  690. ScRelocNotifications(int cNotification, LPNOTIFICATION lpNotifications,
  691.         LPVOID lpvBaseOld, LPVOID lpvBaseNew, ULONG FAR *lpcb);
  692.  
  693.  
  694. STDAPI_(SCODE)
  695. ScCountProps(int cValues, LPSPropValue lpPropArray, ULONG FAR *lpcb);
  696.  
  697. STDAPI_(LPSPropValue)
  698. LpValFindProp(ULONG ulPropTag, ULONG cValues, LPSPropValue lpPropArray);
  699.  
  700. STDAPI_(SCODE)
  701. ScCopyProps(int cValues, LPSPropValue lpPropArray, LPVOID lpvDst,
  702.         ULONG FAR *lpcb);
  703.  
  704. STDAPI_(SCODE)
  705. ScRelocProps(int cValues, LPSPropValue lpPropArray,
  706.         LPVOID lpvBaseOld, LPVOID lpvBaseNew, ULONG FAR *lpcb);
  707.  
  708. STDAPI_(SCODE)
  709. ScDupPropset(int cValues, LPSPropValue lpPropArray,
  710.         LPALLOCATEBUFFER lpAllocateBuffer, LPSPropValue FAR *lppPropArray);
  711.  
  712.  
  713. /* General utility functions */
  714.  
  715. /* Related to the OLE Component object model */
  716.  
  717. STDAPI_(ULONG)          UlAddRef(LPVOID lpunk);
  718. STDAPI_(ULONG)          UlRelease(LPVOID lpunk);
  719.  
  720. /* Related to the MAPI interface */
  721.  
  722. STDAPI                  HrGetOneProp(LPMAPIPROP lpMapiProp, ULONG ulPropTag,
  723.                         LPSPropValue FAR *lppProp);
  724. STDAPI                  HrSetOneProp(LPMAPIPROP lpMapiProp,
  725.                         LPSPropValue lpProp);
  726. STDAPI_(BOOL)           FPropExists(LPMAPIPROP lpMapiProp, ULONG ulPropTag);
  727. STDAPI_(LPSPropValue)   PpropFindProp(LPSPropValue lpPropArray, ULONG cValues,
  728.                         ULONG ulPropTag);
  729. STDAPI_(void)           FreePadrlist(LPADRLIST lpAdrlist);
  730. STDAPI_(void)           FreeProws(LPSRowSet lpRows);
  731. STDAPI                  HrQueryAllRows(LPMAPITABLE lpTable, 
  732.                         LPSPropTagArray lpPropTags,
  733.                         LPSRestriction lpRestriction,
  734.                         LPSSortOrderSet lpSortOrderSet,
  735.                         LONG crowsMax,
  736.                         LPSRowSet FAR *lppRows);
  737.  
  738. /* Create or validate the IPM folder tree in a message store */
  739.  
  740. #define MAPI_FORCE_CREATE   1
  741. #define MAPI_FULL_IPM_TREE  2
  742.  
  743. STDAPI                  HrValidateIPMSubtree(LPMDB lpMDB, ULONG ulFlags,
  744.                         ULONG FAR *lpcValues, LPSPropValue FAR *lppValues,
  745.                         LPMAPIERROR FAR *lpperr);
  746.  
  747. /* Encoding and decoding strings */
  748.  
  749. STDAPI_(BOOL)           FBinFromHex(LPTSTR lpsz, LPBYTE lpb);
  750. STDAPI_(SCODE)          ScBinFromHexBounded(LPTSTR lpsz, LPBYTE lpb, ULONG cb);
  751. STDAPI_(void)           HexFromBin(LPBYTE lpb, int cb, LPTSTR lpsz);
  752. STDAPI_(ULONG)          UlFromSzHex(LPCTSTR lpsz);
  753.  
  754. /* Encoding and decoding entry IDs */
  755. STDAPI                  HrEntryIDFromSz(LPTSTR lpsz, ULONG FAR *lpcb,
  756.                         LPENTRYID FAR *lppEntryID);
  757. STDAPI                  HrSzFromEntryID(ULONG cb, LPENTRYID lpEntryID,
  758.                         LPTSTR FAR *lpsz);
  759. STDAPI                  HrComposeEID(LPMAPISESSION lpSession,
  760.                         ULONG cbStoreRecordKey, LPBYTE lpStoreRecordKey,
  761.                         ULONG cbMsgEntryID, LPENTRYID lpMsgEntryID,
  762.                         ULONG FAR *lpcbEID, LPENTRYID FAR *lppEntryID);
  763. STDAPI                  HrDecomposeEID(LPMAPISESSION lpSession,
  764.                         ULONG cbEntryID, LPENTRYID lpEntryID,
  765.                         ULONG FAR *lpcbStoreEntryID,
  766.                         LPENTRYID FAR *lppStoreEntryID,
  767.                         ULONG FAR *lpcbMsgEntryID,
  768.                         LPENTRYID FAR *lppMsgEntryID);
  769. STDAPI                  HrComposeMsgID(LPMAPISESSION lpSession,
  770.                         ULONG cbStoreSearchKey, LPBYTE pStoreSearchKey,
  771.                         ULONG cbMsgEntryID, LPENTRYID lpMsgEntryID,
  772.                         LPTSTR FAR *lpszMsgID);
  773. STDAPI                  HrDecomposeMsgID(LPMAPISESSION lpSession,
  774.                         LPTSTR lpszMsgID,
  775.                         ULONG FAR *lpcbStoreEntryID,
  776.                         LPENTRYID FAR *lppStoreEntryID,
  777.                         ULONG FAR *lppcbMsgEntryID,
  778.                         LPENTRYID FAR *lppMsgEntryID);
  779.  
  780. /* C runtime substitutes */
  781.  
  782.  
  783. STDAPI_(LPTSTR)         SzFindCh(LPCTSTR lpsz, USHORT ch);      /* strchr */
  784. STDAPI_(LPTSTR)         SzFindLastCh(LPCTSTR lpsz, USHORT ch);  /* strrchr */
  785. STDAPI_(LPTSTR)         SzFindSz(LPCTSTR lpsz, LPCTSTR lpszKey); /*strstr */
  786. STDAPI_(unsigned int)   UFromSz(LPCTSTR lpsz);                  /* atoi */
  787.  
  788. STDAPI_(SCODE)          ScUNCFromLocalPath(LPSTR lpszLocal, LPSTR lpszUNC,
  789.                         UINT cchUNC);
  790. STDAPI_(SCODE)          ScLocalPathFromUNC(LPSTR lpszUNC, LPSTR lpszLocal,
  791.                         UINT cchLocal);
  792.  
  793. /* 64-bit arithmetic with times */
  794.  
  795. STDAPI_(FILETIME)       FtAddFt(FILETIME ftAddend1, FILETIME ftAddend2);
  796. STDAPI_(FILETIME)       FtMulDwDw(DWORD ftMultiplicand, DWORD ftMultiplier);
  797. STDAPI_(FILETIME)       FtMulDw(DWORD ftMultiplier, FILETIME ftMultiplicand);
  798. STDAPI_(FILETIME)       FtSubFt(FILETIME ftMinuend, FILETIME ftSubtrahend);
  799. STDAPI_(FILETIME)       FtNegFt(FILETIME ft);
  800.  
  801. /* Message composition */
  802.  
  803. STDAPI_(SCODE)          ScCreateConversationIndex (ULONG cbParent,
  804.                             LPBYTE lpbParent,
  805.                             ULONG FAR * lpcbConvIndex,
  806.                             LPBYTE FAR * lppbConvIndex);
  807.  
  808. /* Store support */
  809.  
  810. STDAPI WrapStoreEntryID (ULONG ulFlags, LPTSTR lpszDLLName, ULONG cbOrigEntry,
  811.     LPENTRYID lpOrigEntry, ULONG *lpcbWrappedEntry, LPENTRYID *lppWrappedEntry);
  812.  
  813. /* RTF Sync Utilities */
  814.  
  815. #define RTF_SYNC_RTF_CHANGED    ((ULONG) 0x00000001)
  816. #define RTF_SYNC_BODY_CHANGED   ((ULONG) 0x00000002)
  817.  
  818. STDAPI_(HRESULT)
  819. RTFSync (LPMESSAGE lpMessage, ULONG ulFlags, BOOL FAR * lpfMessageUpdated);
  820.  
  821.  
  822. /* Flags for WrapCompressedRTFStream() */
  823.  
  824. /****** MAPI_MODIFY             ((ULONG) 0x00000001) mapidefs.h */
  825. /****** STORE_UNCOMPRESSED_RTF  ((ULONG) 0x00008000) mapidefs.h */
  826.  
  827. STDAPI_(HRESULT)
  828. WrapCompressedRTFStream (LPSTREAM lpCompressedRTFStream,
  829.         ULONG ulFlags, LPSTREAM FAR * lpUncompressedRTFStream);
  830.  
  831. /* Storage on Stream */
  832.  
  833. #if defined(_WIN32) || defined(WIN16)
  834. STDAPI_(HRESULT)
  835. HrIStorageFromStream (LPUNKNOWN lpUnkIn,
  836.     LPCIID lpInterface, ULONG ulFlags, LPSTORAGE FAR * lppStorageOut);
  837. #endif
  838.  
  839.  
  840. /*
  841.  * Setup and cleanup. 
  842.  *
  843.  * Providers never need to make these calls.
  844.  *
  845.  * Test applications and the like which do not call MAPIInitialize
  846.  * may want to call them, so that the few utility functions which
  847.  * need MAPI allocators (and do not ask for them explicitly)
  848.  * will work.
  849.  */
  850.  
  851. /* All flags are reserved for ScInitMapiUtil. */
  852.  
  853. STDAPI_(SCODE)          ScInitMapiUtil(ULONG ulFlags);
  854. STDAPI_(VOID)           DeinitMapiUtil(VOID);
  855.  
  856.  
  857. /*
  858.  *  Entry point names.
  859.  *  
  860.  *  These are for new entry points defined since MAPI first shipped
  861.  *  in Windows 95. Using these names in a GetProcAddress call makes
  862.  *  it easier to write code which uses them optionally.
  863.  */
  864.  
  865. #if defined (WIN16)
  866. #define szHrDispatchNotifications "HrDispatchNotifications"
  867. #elif defined (_WIN32) && defined (_X86_)
  868. #define szHrDispatchNotifications "_HrDispatchNotifications@4"
  869. #elif defined (_ALPHA_) || defined (_MIPS_) || defined (_PPC_)
  870. #define szHrDispatchNotifications "HrDispatchNotifications"
  871. #endif
  872.  
  873. typedef HRESULT (STDAPICALLTYPE DISPATCHNOTIFICATIONS)(ULONG ulFlags);
  874. typedef DISPATCHNOTIFICATIONS FAR * LPDISPATCHNOTIFICATIONS;
  875.  
  876. #if defined (WIN16)
  877. #define szScCreateConversationIndex "ScCreateConversationIndex"
  878. #elif defined (_WIN32) && defined (_X86_)
  879. #define szScCreateConversationIndex "_ScCreateConversationIndex@16"
  880. #elif defined (_ALPHA_) || defined (_MIPS_) || defined (_PPC_)
  881. #define szScCreateConversationIndex "ScCreateConversationIndex"
  882. #endif
  883.  
  884. typedef SCODE (STDAPICALLTYPE CREATECONVERSATIONINDEX)(ULONG cbParent,
  885.     LPBYTE lpbParent, ULONG FAR *lpcbConvIndex, LPBYTE FAR *lppbConvIndex);
  886. typedef CREATECONVERSATIONINDEX FAR *LPCREATECONVERSATIONINDEX;
  887.  
  888. #ifdef __cplusplus
  889. }
  890. #endif
  891.  
  892. #ifdef __BORLANDC__
  893. #  include <poppack.h>
  894. #endif
  895.  
  896. #pragma option pop
  897. #endif /* _MAPIUTIL_H_ */
  898.